1. Field of the Invention
The present invention relates to a text editing system with a line feed function and an indentation function.
2. Description of the Prior Art
Today, word processors and personal computers in which word processing software is built in are being widely used as document composition tools. When these tools are used, a setting process relating to a document style is executed prior to the composition of a document, and a text editing process is executed during the composition of a document. For example, the left and right margins of lines of a document, the number of characters per line, the number of lines per page, the size of a used font, etc., are set prior to the composition of a document. Every time a character is inserted or deleted during the composition of a document, an editing process is executed and the data of a document file is rewritten.
In a conventional text editing system, such as a word processor, etc., in order to set the left and right margins of lines, a special code for a margin was used, or special information for line control was used, separately from character codes. A special code for a margin, for example, varies with the type of word processor or computer, and the line end line feed position was set by inserting this code. Special information for line control is stored in a document formatting file provided separately from document files. In this formatting file, for example, information about the position of a character and the layout of a document, and even information about line feed, etc., are stored, and by referring to these pieces of information, a document is composed.
Therefore, since document editing is performed based on a special code, etc., the number of characters per line and the number of blanks at the head of a line in a document were not counted and the document was not edited based on the count result when a character has to be shifted to the next line or a character has to be acquired from the next line during document editing.
Japanese Laid-open Patent Gazette (Japanese Patent Laid-open No. 10-162004) discloses a character string display apparatus for displaying character strings in good order while maintaining the indented display of character strings when the size of the rectangular area of a window screen for displaying character strings is changed.
However, the above-described conventional text editing system has the following problems.
First, since a document composed using a special code for margin or special information for line control depends heavily on the type of word processor or computer, the document cannot be handled in a different type of text editing system. Therefore, document compatibility is low, allowing only very low-versatility documents to be composed.
If a file for format setting is used separately from document files, the number of files increases and the greater number of files requires a large memory capacity, which occupies a large part of the memory capacity of a storage unit.
Furthermore, in the case of the above-described Japanese Patent Laid-open No. 10-162004, although a blank maintaining process is executed when the size of a window screen is changed, a prescribed blank maintaining process is not executed when a character is inserted or deleted.
A goal of the present invention is to provide a high-portability text editing system such that the above-described problem can be solved. A body of text composed using the text editing system of the present invention can be handled in a general viewer or editor and a high-versatility text can be composed.
According to the present invention, the above-described objective can be achieved by providing a text editing system for editing a body of text in such a way that each line is left-justified and the number of characters per line is always within a prescribed limit. The text editing system comprises a line end position storage unit for storing a line end position, a line feed code detection unit for detecting a line feed code in text, a character code count unit for counting the number of character codes between the head of a body of text and up to immediately before the first line feed code detected by the line feed code detection unit, or the number of character codes located between line feed codes detected by the line feed code detection unit, and a line code position shift unit for shifting the position of the latest line feed code detected by the line feed code detection unit to immediately after the line end position if the number of character codes counted by the character code count unit and the line end position stored in the line end position storage unit do not match.
The line end position storage unit stores information indicating the line end position of a line, and allowing, for example, a predetermined value to be used. The maximum line end position in text (a document), the end position of the most frequently occurring line in a body of text, the end position of the first line in a text or if a plurality of lines with the same number of characters continue in a body of text, the end position of a plurality of lines can also be used for the line end position. Alternatively, the end position of a line immediately before a line in which a character is inputted can be used as the line end position.
The line feed code detection unit detects a line feed code included in a body of text, which is a high-versatility code used in a body of text.
The line feed code shift unit shifts the position of a line feed code when the number of characters in a specific line of a body of text is changed by inserting or deleting a character in the line. For example, when N characters are inserted in a specific line of a body of text, the number of characters in the line increases by N. For example, when N characters are deleted from a specific line of a body of text, the number of characters in the line decreases by N (assuming that the original number of characters of the specific line is M, M greater than N is assumed). In such a case, the line feed code shift unit shifts the position of the line feed code in such a way that the number of characters of all lines following the line in which an insertion/deletion is being made except for the last line, becomes N. In this case, the number of characters in the last line becomes N or less.
The first aspect of the present invention can also comprise a count unit for counting the number of characters per line in a body of text and an editing unit for shifting characters to or acquiring characters from the next line by the same number of characters that were inserted or deleted in the line, without changing the number of characters in the line and for editing lines when characters are inserted or deleted in a specific line of a body of text during editing. In this case, the count unit corresponds to the count unit of the first preferred embodiment described later, and the editing unit corresponds to the line feed code position shift unit in the first preferred embodiment. In this case, xe2x80x9cwhen characters are inserted or deleted in a specific line of a body of text during editingxe2x80x9d includes a case where a user directly edits a specific line as well as a case where as a result of the user directly editing a specific line, another line is also edited.
According to the text editing system in one aspect of the present invention having the above-described configuration, a body of text can be edited in such a way that all lines of a body of text are left- and right-justified using line feed codes.
According to the second aspect of the present invention, the above-described object can be achieved by providing a text editing system for editing a body of text in which one or more prescribed blank codes are permanently located. The text editing system comprises a screen line end position storage unit for storing the number of characters per line of a screen, a blank code detection unit for detecting black codes in a body of text, a character code count unit for counting the number of character codes between the head of a body of text up to immediately before the first blank code detected by the blank code detection unit, or the number of character codes located between two bank codes detected by the blank code detection unit, and a blank code position shift unit for locating the prescribed number of blank codes at the head of the line by replacing the position of a blank code detected by the blank code detection unit with the position of a character code existing before the blank code.
The second aspect of the present invention can also comprise a count unit for counting the number of characters of the next line and the number of blanks at the head of a blank portion when characters are inserted or deleted in a specific line of a body of text during editing and an editing unit for shifting characters by the same number of characters as inserted or deleted in the line, without changing both the number of characters and the number of blanks at the head of the next line, and editing lines when characters are inserted or deleted in a specific line of a body of text. In this case, the count unit corresponds to the character code count unit in the second preferred embodiment described later, and the editing unit corresponds to the blank code position shift unit in the second preferred embodiment. In this case, xe2x80x9cwhen characters are inserted or deleted in a specific line of a body of text during editingxe2x80x9d includes a case where a user directly edits a specific line as well as a case where as a result of the user directly editing a specific line, another line is also edited.
The second aspect of the present invention relates to an indentation function. For example, if the second and subsequent lines are indented and if characters are inserted or deleted in a specific line, a body of text can be edited in such a way that the same indentation as that made in the original body of text can be made by replacing the position of a blank code shifted by the blank code position shift unit with the position of the character code based on the detection results of the screen line end position storage unit and blank code detection unit and the count result of the count unit. In this case, since the blank code portion at the head of a line is judged and processed as an indentation, there is no need for a file in which a special code and information about indentation are stored, and thereby an indentation function can be realized simply by setting the number of characters per line of a screen.